#!/usr/bin/python
# -*- coding: utf-8 -*-
# @version        : 1.0
# @Create Time    : 2025/3/25 11:11
# @File           : need.py
# @IDE            : PyCharm
# @desc           : 描述

from sqlalchemy.orm import Mapped, mapped_column, relationship
from db.db_base import BaseModel, AuditModel
from sqlalchemy import Boolean, ForeignKey, String, Text


class DCTaskWorkTeam(AuditModel):
    __tablename__ = "dc_dispatch_work_team"
    __table_args__ = (
        {'comment': '工序外协班组'}
    )
    ticket_id: Mapped[int] = mapped_column(
        String(50),
        ForeignKey("dc_dispatch_task.ticket_id", ondelete="CASCADE"),
        comment="工单ID"
    )
    task = relationship("DCTask", foreign_keys=ticket_id, back_populates="work_teams")
    
    name: Mapped[str] = mapped_column(String(20), index=True, comment="外协班组名")
    work_no: Mapped[str] = mapped_column(String(20), nullable=True, comment="工序号")
    work_title: Mapped[str] = mapped_column(String(20), nullable=True, comment="工序标题")
    work_start: Mapped[str] = mapped_column(String(20), nullable=True, comment="工序开始时间")

    send_message: Mapped[bool] = mapped_column(Boolean, default=False, comment="是否已发送通知")
    remark: Mapped[str] = mapped_column(Text, nullable=True, comment="备注")
